package com.builder.improve;

/**
 * @author 薛虎
 * @date 2021/1/6 11:15
 * 指挥者,这里动态的去指定制作流程,返回产品
 */
public class HouseDirector {

    HouseBuilder houseBuilder = null;

    //构造器哦传入houseBuilder
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }


    //通过setter传入houseBuilder
    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //指挥具体的建造流程(如何处理建造房子的流程)，交给指挥者
    public House constructHouse() {
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return houseBuilder.buildHouse();
    }
}
